import request from '@/utils/request.js'
// 一级分类列表获取
// GET /admin/product/getCategory1
export const reqCategory1List = () => request({ url: '/admin/product/getCategory1', method: 'get' })

// 二级分类列表获取
// GET /admin/product/getCategory2/{category1Id}
export const reqCategory2List = (category1Id) => request({ url: `/admin/product/getCategory2/${category1Id}`, method: 'get' })

// 三级分类列表获取
// GET /admin/product/getCategory3/{category2Id}
export const reqCategory3List = (category2Id) => request({ url: `/admin/product/getCategory3/${category2Id}`, method: 'get' })

// 获取商品基础属性
// GET /admin/product/attrInfoList/{category1Id}/{category2Id}/{category3Id}
export const reqAttrList = (category1Id, category2Id, category3Id) => request({ url: `/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`, method: 'get' })

// 获取属性名与属性值(保存保存操作按钮)
// POST /admin/product/saveAttrInfo
// id由服务器生成，不用带
// {
//   "attrName": "string",
//   "attrValueList": [
//     {
//       "attrId": 0,
//       "id": 0,
//       "valueName": "string"
//     }
//   ],
//   "categoryId": 0,
//   "categoryLevel": 0,
// }
export const reqAddAttr = (data) => request({ url: '/admin/product/saveAttrInfo', method: 'post', data: data })

// 删除商品属性
// DELETE /admin/product/deleteAttr/{attrId}
export const deleteAttr = (attrId) => request({ url: `/admin/product/deleteAttr/${attrId}`, method: 'delete' })
